/*
ID:luongho3
TASK:rockers
LANG:C++
*/
#include <iostream>
#include <fstream>
using namespace std;
#define MAX 25
ifstream fin("rockers.in");
ofstream fout("rockers.out");
int m[MAX][MAX][MAX]; // m[i][j][k] - the maximum number of songs included when we've progressed to disc i, the last selected
                      // is k, and the disc still has used j minutes 
int slen[MAX];
int main() {
    int nsong, nmin, ndisc;
    fin >> nsong >> nmin >> ndisc;
    int i,j,k,l,best;
    for (i=1;i<=nsong;++i) {
        fin >> slen[i];
    }
    best = -1;
    j=1;
    for (i=1;i<=ndisc;++i) {
        for (j=0;j<=nmin;++j) {
            for (k=0;k<=nsong;++k) {
                for (l=k+1;l<=nsong;++l) {
                    if (slen[l] <= nmin - j) {
                       if (m[i][j][k] + 1 > m[i][j+slen[l]][l]) {
                          m[i][j+slen[l]][l] = m[i][j][k] + 1;
                       }
                    }
                    else {
                         if (m[i][j][k] + 1 > m[i+1][slen[l]][l]) {
                            m[i+1][slen[l]][l] = m[i][j][k] + 1;
                         }
                    }
                }
                if (m[i][j][k]>best) best = m[i][j][k];
            }
        }
    }
    fout << best << "\n";
    return 0;
}
